*/
function edit() {
global $wgOut, $wgUser, $wgRequest, $wgTitle;
-
+
if ( ! wfRunHooks( 'AlternateEdit', array( &$this ) ) )
return;
-
+
$fname = 'EditPage::edit';
wfProfileIn( $fname );
wfDebug( "$fname: enter\n" );
}
wfProfileIn( "$fname-business-end" );
-
+
$this->isConflict = false;
// css / js subpages of user pages get a special treatment
$this->isCssJsSubpage = $wgTitle->isCssJsSubpage();
-
+
/* Notice that we can't use isDeleted, because it returns true if article is ever deleted
* no matter it's current state
*/
}
}
}
-
+
if(!$this->mTitle->getArticleID() && ('initial' == $this->formtype || $this->firsttime )) { # new article
$this->showIntro();
}
return;
}
}
-
+
# First time through: get contents, set time for conflict
# checking, etc.
if ( 'initial' == $this->formtype || $this->firsttime ) {
} else {
$this->preview = $request->getCheck( 'wpPreview' );
$this->diff = $request->getCheck( 'wpDiff' );
-
+
if( !$this->preview ) {
if ( $this->tokenOk( $request ) ) {
# Some browsers will not report any submit button
if( !preg_match( '/^\d{14}$/', $this->starttime )) {
$this->starttime = null;
}
-
+
$this->recreate = $request->getCheck( 'wpRecreate' );
$this->minoredit = $request->getCheck( 'wpMinoredit' );
$this->live = $request->getCheck( 'live' );
$this->editintro = $request->getText( 'editintro' );
-
+
wfProfileOut( $fname );
}
*/
function attemptSave() {
global $wgSpamRegex, $wgFilterCallback, $wgUser, $wgOut;
-
+
$fname = 'EditPage::attemptSave';
wfProfileIn( $fname );
wfProfileIn( "$fname-checks" );
wfProfileOut( $fname );
return true;
}
-
+
wfProfileOut( "$fname-checks" );
-
+
# If article is new, insert it.
$aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
if ( 0 == $aid ) {
wfProfileOut( $fname );
return;
}
-
+
# Don't save a new article if it's blank.
if ( ( '' == $this->textbox1 ) ) {
$wgOut->redirect( $this->mTitle->getFullURL() );
$isComment=($this->section=='new');
$this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
$this->minoredit, $this->watchthis, false, $isComment);
-
+
wfProfileOut( $fname );
return false;
}
$this->mArticle->clear(); # Force reload of dates, etc.
$this->mArticle->forUpdate( true ); # Lock the article
-
+
if( $this->mArticle->getTimestamp() != $this->edittime ) {
$this->isConflict = true;
if( $this->section == 'new' ) {
}
}
}
-
+
if ( $this->isConflict ) {
wfProfileOut( $fname );
return true;
}
-
+
# All's well
wfProfileIn( "$fname-sectionanchor" );
$sectionanchor = '';
wfProfileIn( $fname );
$sk =& $wgUser->getSkin();
-
+
wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
-
+
$wgOut->setRobotpolicy( 'noindex,nofollow' );
# Enabled article-related sidebar, toplinks, etc.
if( !empty( $matches[2] ) ) {
$this->summary = "/* ". trim($matches[2])." */ ";
}
- }
+ }
}
} else {
$s = wfMsg( 'editing', $this->mTitle->getPrefixedText() );
</textarea>
" );
-
+
$wgOut->addWikiText( $copywarn );
$wgOut->addHTML( "
wfProfileOut( $fname );
}
-
+
/**
* Append preview output to $wgOut.
* Includes category rendering if this is a category page.
'editform.wpTextbox1.value,' .
htmlspecialchars( '"' . $liveAction . '"' ) . ')"';
}
-
+
function getLastDelete() {
$dbr =& wfGetDB( DB_SLAVE );
$fname = 'EditPage::getLastDelete';
}
$toparse = $this->textbox1;
-
+
# If we're adding a comment, we need to show the
# summary as the headline
if($this->section=="new" && $this->summary!="") {
$toparse="== {$this->summary} ==\n\n".$toparse;
}
-
+
if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData ;
$parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ) ."\n\n",
? $this->unmakesafe( $text )
: $text;
}
-
+
/**
* Filter an output field through a Unicode armoring process if it is
* going to an old browser with known broken Unicode editing issues.
? $codedText
: $this->makesafe( $codedText );
}
-
+
/**
* A number of web browsers are known to corrupt non-ASCII characters
* in a UTF-8 text editing environment. To protect against this,
function makesafe( $invalue ) {
// Armor existing references for reversability.
$invalue = strtr( $invalue, array( "&#x" => "�" ) );
-
+
$bytesleft = 0;
$result = "";
$working = 0;
}
return $result;
}
-
+
/**
* Reverse the previously applied transliteration of non-ASCII characters
* back to UTF-8. Used to protect data from corruption by broken web browsers
$hexstring .= $invalue{$i};
$i++;
} while( ctype_xdigit( $invalue{$i} ) && ( $i < strlen( $invalue ) ) );
-
+
// Do some sanity checks. These aren't needed for reversability,
// but should help keep the breakage down if the editor
// breaks one of the entities whilst editing.
// reverse the transform that we made for reversability reasons.
return strtr( $result, array( "�" => "&#x" ) );
}
-
+
function noCreatePermission() {
global $wgOut;
$wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) );